Component({
  options: {
    styleIsolation: "shared",
    multipleSlots: true, //启用多slot支持
  },
  behaviors: [],
  properties: {
    hidden: Boolean, ////是否隐藏滚动页面时的下拉栏
    timeType: String,
    city: String,
    county: String,
  },
  data: {
    timePopupShow: false, //是否显示选择时间弹窗
    areaPopupShow: false, //是否显示选择地区弹窗
  },
  lifetimes: {
    created() {
      const { timeType, city, county } = this.properties;
      this.setData({ timeType, city, county });
    },
    attached() {
      const statusBarHeight = wx.getWindowInfo().statusBarHeight;
      const menuInfo = wx.getMenuButtonBoundingClientRect();
      const marginTop =
        -(menuInfo.top - statusBarHeight + menuInfo.bottom) + "px";
      this.setData({
        marginTop,
        bottomSafe: wx.getStorageSync("bottomSafe") + "px",
      });
    },
    moved() {},
    detached() {},
  },
  methods: {
    showTimePopup() {
      this.setData({ timePopupShow: true });
    },
    showAreaPopup() {
      this.setData({ areaPopupShow: true });
    },
    /**
     * 更新时间类型
     * @param {*} e
     */
    getTimeType(e) {
      this.setData({ timeType: e.detail });
    },
    /**
     * 更新市区位置
     * @param {*} e
     */
    getArea(e) {
      this.setData({
        city: e.detail[0],
        county: e.detail[1],
      });
    },
  },
});
